package com.xpalive.base;

import static com.baomidou.mybatisplus.annotation.IdType.ASSIGN_ID;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import lombok.Data;

@Data
public class BaseEntity implements Entity {

    @TableId(
        type = ASSIGN_ID
    )
    private Long id;
    @TableField(value = "CREATOR", fill = FieldFill.INSERT)
    private Long creator;
    @TableField(value = "CREATE_DATETIME", fill = FieldFill.INSERT)
    private LocalDateTime createDatetime;
    @TableField(value = "EDITOR", fill = FieldFill.INSERT_UPDATE)
    private Long editor;
    @TableField(value = "EDIT_DATETIME", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime editDatetime;
    /**
     * 是否删除（逻辑删除Y/N）
     */
    @TableLogic(value = "N", delval = "Y")
    @TableField(value = "DELETED", fill = FieldFill.INSERT, select = false)
    @ApiModelProperty(hidden = true)
    private String deleted;

    @Version
    @TableField(value = "VERSION", fill = FieldFill.INSERT_UPDATE)
    private Integer version;
}
